package com.cloud.school.app.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils;

/**
 * Created by enHui.Chen on 2019/1/27.
 */
@ApiModel("聊天记录信息扩展对象")
public class MesageEngineModel extends MessageModel {
    @ApiModelProperty("新消息总数")
    private int newMessageCount;

    public int getNewMessageCount() {
        return newMessageCount;
    }

    public void setNewMessageCount(int newMessageCount) {
        this.newMessageCount = newMessageCount;
    }

    public void setNewMessageCount(String newMessageCount) {
        if (StringUtils.isEmpty(newMessageCount)) {
            this.newMessageCount = 0;
        } else {
            this.newMessageCount = Integer.valueOf(newMessageCount);
        }
    }

    public MesageEngineModel() {
    }

    public MesageEngineModel(MessageModel messageModel) {
        setStatus(messageModel.getStatus());
        setId(messageModel.getId());
        setSendUid(messageModel.getSendUid());
        setSender(messageModel.getSender());
        setSendTime(messageModel.getSendTime());
        setReceiveType(messageModel.getReceiveType());
        setReceiveId(messageModel.getReceiveId());
        setMsgType(messageModel.getMsgType());
        setMsgData(messageModel.getMsgData());
    }
}
